package com.kk.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @author kl
 * @version 1.0
 * @description: TODO
 * @date 2025/10/16 下午5:19
 */
@Getter
@AllArgsConstructor
public enum MenuTypeEnum implements BaseEnum<Integer> {

    /**
     * 目录
     */
    DIRECTORY(1, "目录"),

    /**
     * 菜单
     */
    MENU(2, "菜单"),

    /**
     * 按钮
     */
    BUTTON(3, "按钮");

    @EnumValue
    @JsonValue
    private final Integer value;

    private final String label;

    private static final Map<Integer, MenuTypeEnum> VALUE_MAP =
            Arrays.stream(values())
                    .collect(Collectors.toMap(MenuTypeEnum::getValue, e -> e));

    public static MenuTypeEnum of(Integer value) {
        return VALUE_MAP.get(value);
    }
}